package com.dingqb.ktdemo.oop.interface1


class Likejavaapi8 : MyInterface {
    override var name: String = "--"
        get() = field
        set(value) {
            field = value
        }
    override var age: Int = 0
        get() = field
        set(value) {
            field = value
        }

    override fun foo() {
        println("override foo")
    }

    override fun getDefault(): String {
        return "likejavaapi8 "
    }

}

fun main() {
    var like = Likejavaapi8();
    like.foo();
    var value = like.getDefault();
    println(value)
}

/**
 * 说明：1、接口中的方法可以有默认的实现类似java 8
 * 2、接口中的属性只能是抽象的，这个与java完全不一样
 */
interface MyInterface {
    var name: String
    var age: Int
    fun foo();
    fun getDefault(): String {
        return "Default"

    }
}
